package com.ibeeking.found.common.enums;

public enum PaymentStatusEnum {

    PAID(0, "支付成功"),
    UNPAID(1, "支付失败"),
    /*UNPAID(100, "成功"),
    UNPAID(300, "退款"),
    UNPAID(302, "退款"),
    UNPAID(303, "退款"),
    UNPAID(500, "作废"),
    UNPAID(501, "作废"),
    UNPAID(502, "作废"),*/
    ;

    private Integer code;
    private String name;

    PaymentStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public Integer getCode() {
        return code;
    }

    public static String getNameByCode(Integer code) {
        for (PaymentStatusEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj.getName();
            }
        }
        return null;
    }

    public static Integer getCodeByName(String name) {
        for (PaymentStatusEnum enumObj : values()) {
            if (enumObj.getName().equals(name)) {
                return enumObj.getCode();
            }
        }
        return null;
    }
}
